JavaScript

NumbertoPlace Method

Syntax

Number.toPlace()

Returns

valuestring

A string with the integer place representation of the number.

Description

Extension to the native number variable to convert a number place string.

Example

var num = 21;
var numStr = num.toPlace(); // numStr = '21st'
num = 3;
numStr = num.toPlace(); // numStr = '3rd'